Check whether a number is in a given rangeΒΆ
Write a python function to check whether a number is in a given range.
def check_in_range(N):
if N in range(3, 9):
print( " %s is in the range"%str(N))
else :
print("The number is outside the given range.")
# test
check_in_range(5)
Output:
5 is in the range